package sixth.抽象类与接口的应用.为抽象类与接口实例化;
interface A1{public void print();
}
class B1 implements A1{
    public void print(){
        System.out.println("print.....");
    }
}
public class 为接口实例化 {
    public static void main(String[] args) {
        A1 a = new B1();//通过子类为接口实例化
        a.print();//调用的方法是覆写过的方法
    }
}
/*
D:\WorkSpaces\Java\jdk-21\bin\java.exe "-javaagent:D:\Software\IntelliJ IDEA\IntelliJ IDEA 2023.3.2\lib\idea_rt.jar=49373:D:\Software\IntelliJ IDEA\IntelliJ IDEA 2023.3.2\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath D:\WorkSpaces\JavaDevelopBase_start_329\out\production\JavaDevelopBase_start_329 sixth.抽象类与接口的应用.为抽象类与接口实例化.为接口实例化
print.....

Process finished with exit code 0
 */